package Pair5.v3;

public class Timecounter extends Thread{
	private javax.swing.JProgressBar timebar;
	private int i;
	private boolean running;
	public Timecounter(javax.swing.JProgressBar timebar){
		this.timebar=timebar;
	}
	
	public void reset(){
		i=0;
	}
	public void run(){
		for(i=0;i<timebar.getMaximum();){
			while(!running){
				try{
					Thread.sleep(500);
				}catch(Exception e){}
			}
			timebar.setValue(i);
			try{
				Thread.sleep(400);
			}catch (Exception ex){
				
			}
			i++;
		}
		
	}
	public void go(){
		running=true;
	}
		
	public void pause(){
		running=false;
	}
}
